package com.lm.upms.api.dto;

import com.lm.upms.api.vo.MenuVO;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 菜单树
 *
 * @author lm
 * @date 2019/5/31
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class MenuTree extends TreeNode {

    private boolean spread = false;

    private String authority;
    private String redirect;
    private String keepAlive;
    private String code;
    private String type;
    private String label;
    private Integer sort;
    private String name;
    private String url;
    private String path;
    private String component;
    private String menuPath;
    private String menuComponent;
    private String visible;
    private String perms;
    private String icon;
    /**
     * menuName，对应antd中的title
     */
    private String title;
    /**
     * menuPath，对应antd中的title
     */
    private String key;

    public MenuTree() {
    }

    public MenuTree(int id, String name, int parentId) {
        this.id = id;
        this.parentId = parentId;
        this.name = name;
        this.title = name;
    }

    public MenuTree(int id, String name, MenuTree parent) {
        this.id = id;
        this.parentId = parent.getId();
        this.name = name;
        this.title = name;
    }

    public MenuTree(MenuVO menuVo) {
        this.id = menuVo.getMenuId();
        this.parentId = menuVo.getParentId();
        this.icon = menuVo.getIcon();
        this.name = menuVo.getMenuName();
        this.url = menuVo.getUrl();
        this.path = menuVo.getPath();
        this.component = menuVo.getComponent();
        this.menuPath = menuVo.getMenuPath();
        this.menuComponent = menuVo.getMenuComponent();
        this.type = menuVo.getMenuType();
        this.label = menuVo.getMenuName();
        this.sort = menuVo.getOrderNum();
        this.keepAlive = menuVo.getKeepAlive();
        this.title = menuVo.getMenuName();
        this.key = menuVo.getMenuPath();
        this.redirect = menuVo.getMenuComponent();
    }

}